home *** CD-ROM | disk | FTP | other *** search
- Path: news.pge.com!usenet
- From: psk3@pge.com (Phillip Knight)
- Newsgroups: comp.lang.c++,comp.unix.programmer
- Subject: Re: c++ static objects and fork
- Date: 28 Jan 1996 17:09:55 GMT
- Organization: Pacific Gas and Electric
- Message-ID: <4egal3$jmg@news02.comp.pge.com>
- References: <4e8qu5$cmb@news02.comp.pge.com> <4eaqok$7pr@GIMLI.genias.de>
- NNTP-Posting-Host: psk3ws04.comp.pge.com
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-Newsreader: WinVN 0.99.6
-
- In article <4eaqok$7pr@GIMLI.genias.de>, andreas says...
- >
- >Hi Phil,
- >
- >I didn't test your question with an example. But I would
- >say that nothing happens to these static objects.
- >What should happen?
- >
- >fork() makes a copy of the whole writable memory of the
- >forked process (some special operations are done with
- >open file descriptors) and starts a new process (one
- >could say fork() is a kind of copy constructor for
- >processes).
- >
- >Did you expect that fork() would call a copy
- >constructor for static objects?
- >
-
- Andreas, I am not to concerned about the data (fork does make
- a complete copy), but what about all those vtable pointers, etc?
- Are these going to be valid (I know they are data in by themselves,
- but they are now in a new process, and as such, does fork guarentee
- their validity?).
-
- An simple example of my concern is what happens to cin/cout/cerr/clog
- after a fork? they seem to operate ok in tests, but i want to be positive
- (my app derives off of ostream, and after forking seem to behave somewhat
- strangely, although it hasnt been fully debugged yet.)
-
- as always, thanks in advance,
- phil knight
- psk3@pge.com
-
-